<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
   请输入: <input id="num" type="text" /><br />
    <input type="button" value="星期几呢" onclick="fn()"><br />
    结果；<input id="result" type="text"><br />
    <script>
        function fn() {
            // 1输入
            var num = document.getElementById("num").value;
            //   2.逻辑
            var week = "";
            switch (num) {
                case "0": week = "星期天"; break;
                case "1": week = "星期一"; break;
                case "2": week = "星期二"; break;
                case "3": week= "星期三"; break;
                case "4": week = "星期四"; break;
                case "5": week = "星期五"; break;
                case "6": week = "星期六"; break;
            }
            document.getElementById("result").value = week;
        }
    </script>
</body>
</html>